/*
 * @Author: wangyage wangyage@zhejianglab.com
 * @Date: 2022-10-08 09:33:37
 * @LastEditors: wangyage wangyage@zhejianglab.com
 * @LastEditTime: 2022-10-08 10:50:08
 * @FilePath: \aiworks\frontend\apps\kg-application\src\util\prefix-utils.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/**
 * 图谱数据有前缀，需要去掉
 * @param str
 * @param prefix
 * @returns
 */
export function removePrefix(item: string, prefix: string) {
  return !!item && item.includes(`${prefix}#`) ? item.split('#')[1] : item
}
/**
 * 简单除暴去掉前缀
 * @param info
 * @param prefix
 * @returns
 */
export function shapePrefixInfo(info: any, prefix: any) {
  const stringifyInfo = JSON.stringify(info)
  const replaceInfo = stringifyInfo.replaceAll(`${prefix}#`, '')
  return JSON.parse(replaceInfo)
}
